package com.cn.validator;

import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;

public class SubmitOrderValidator extends Validator {


	@Override
	protected void validate(Controller c) {
		validateRequired("province", "message", "地址不能为空！");
		validateRequired("city", "message", "地址不能为空！");
		validateRequired("detailAddress", "message", "地址不能为空！");
		validateRequired("receiver", "message", "收货人不能为空！");
		validateRequired("receiverPhone", "message", "收货人电话不能为空！");
		c.setAttr("caozuo", true);
	}

	@Override
	protected void handleError(Controller c) {
		c.setAttr("caozuo", false);
		c.renderJson();
	}

}
